package com.ruoyi.controller;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.grpc.AsrClient;
import com.ruoyi.handler.IflytekAsrHandler;
import com.ruoyi.model.AsrParams;
import com.ruoyi.model.AsrVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("mtScylla")
public class MtScyllaController {
    @Autowired
    private IflytekAsrHandler asrHandler;

    @Autowired
    private AsrClient asrClient;

    @GetMapping("start")
    public AjaxResult start(String filePath) throws Exception {
        AsrParams asrParams = new AsrParams();
        asrParams.setFilePath("D:\\JavaProject\\scylla\\sample\\Java\\Demo\\bin_test\\audio\\16k.wav");
        AsrVO asrVO = asrHandler.start(asrParams);
        return AjaxResult.success(asrVO);
        // return AjaxResult.success();
    }

    @GetMapping("handle")
    public String handle(){
        asrClient.handle();
        return "1";
    }
}
